import { getWaitCheckOrderEvent } from '@/api/order'
import { ref } from 'vue'
import { PendingReviewEvent } from './types'

// 加载
const loading = ref(false)

// 待审核事件
const pendingPreviewEventList = ref<Array<PendingReviewEvent>>([])

/**
 * 获取待审核事件方法
 * @param {string} id 工单id
 */
const get = async (id: string) => {
  loading.value = true
  const res = await getWaitCheckOrderEvent(id)
  loading.value = false
  pendingPreviewEventList.value = res.data.data.rows.filter((item) => ![1, 3].includes(item.type))
}

export default { loading, pendingPreviewEventList, get }
